import http from '../utils/request'

// 商品相关请求

interface IResData {
  code: string
  message: string
  data: {
    token: string
    adminname: string
  }
}

//获取商品列表数据
function productListRequest(count: number, limitNum: number, search = '', category = '') {
  return http<IResProListData>({
    method: 'get',
    url: '/admin/pro/list',
    params: { count, limitNum, search, category },
  })
}
//删除商品列表数据
function productDelRequest(proid: string) {
  return http<IResData>({
    method: 'delete',
    url: '/admin/pro/product/' + proid,
    params: { proid },
  })
}
//修改商品列表数据
function productUpdateRequest(proid: string, obj: object) {
  return http<IResData>({
    method: 'patch',
    url: '/admin/pro/product/' + proid,
    params: { proid },
    data: obj,
  })
}
//添加商品列表数据
function productAddRequest(obj: object) {
  return http<IResData>({
    method: 'post',
    url: '/admin/pro/product',
    data: obj,
  })
}


export { productListRequest, productDelRequest, productUpdateRequest, productAddRequest }
